/*
 * Created on Feb 16, 2005
 */
package com.scalar.chiptrack.finance.openpo.dao;

import java.util.ArrayList;

import com.scalar.ScalarException;
import com.scalar.chiptrack.commons.Address;
import com.scalar.chiptrack.finance.openpo.forms.OpenPurchaseOrderForm;
import com.scalar.chiptrack.finance.openpo.forms.PurchaseOrderReceiptForm;
import com.scalar.chiptrack.finance.openpo.forms.PurchaseOrderSearchForm;
import com.scalar.chiptrack.finance.openpo.forms.PurchaseOrderForm;
import com.scalar.chiptrack.finance.openpo.forms.ReceiptSearchForm;
import com.scalar.chiptrack.finance.openpo.PurchaseOrderLineItemLotDataEntryList;
import com.scalar.chiptrack.db.DBTransaction;

/**
 * @author Ravikanth
**/
public interface IPurchaseOrderDAO
{

	/**
	 * @return
	 */
	public ArrayList loadPOVendors() throws ScalarException;

	/**
	 * @return
	 */
	public ArrayList loadAllVendors() throws ScalarException;

	/**
	 * @param purchaseOrderSearchForm
	 * @return
	 */
	public ArrayList searchOpenPO(PurchaseOrderSearchForm purchaseOrderSearchForm) throws ScalarException;

	/**
	 * @return
	 */
	public String loadAutomatedPurchaseOrderNo() throws ScalarException;

	/**
	 * @return
	 */
	public Address getClientAddress() throws ScalarException;

	/**
	 * @param poNumber
	 */
	public boolean isPurchaseOrderNumberExists(String poNumber) throws ScalarException;

	/**
	 * @param purchaseOrderForm
	 */
	public void saveOpenPurchaseOrder( OpenPurchaseOrderForm purchaseOrderForm, String userName ) throws ScalarException;

	/**
	 * @param purchaseOrderForm
	 */
	public void loadOpenPurchaseOrder(OpenPurchaseOrderForm purchaseOrderForm) throws ScalarException;

	/**
	 * @param purchaseOrderSearchForm
	 */
	public ArrayList searchPurchaseOrder(PurchaseOrderSearchForm purchaseOrderSearchForm) throws ScalarException;

	/**
	 * @return
	 */
	public ArrayList loadPOProductsList() throws ScalarException;


    /**
     * @param purchaseOrderForm
     */
    public void savePurchaseOrder( PurchaseOrderForm purchaseOrderForm, String userName ) throws ScalarException;

    /**
     * @param purchaseOrderForm
     */
    public PurchaseOrderForm loadPurchaseOrder(PurchaseOrderForm purchaseOrderForm, boolean loadCancelledPurchaseOrder ) throws ScalarException;


	/**
	 * @param purchaseOrder_Id
	 */
	public ArrayList loadRelatedPos(int purchaseOrder_Id) throws ScalarException;

	/**
	 * @param purchaseOrder_Id
	 * @return Audot Trail informatiom
	 */
	public ArrayList loadPOAuditTrail(int purchaseOrder_Id) throws ScalarException;

	/**
	 * @param vendor_id
	 * @return
	 */
	public ArrayList loadVendorShippingAddresses(int vendor_id) throws ScalarException;

	/**
	 * @param receiptSearchForm
	 * @return
	 */
	public ArrayList searchRecciptOrder(ReceiptSearchForm receiptSearchForm) throws ScalarException;

	/**
	 * @param receiptSearchForm
	 * @return
	 */
	public ArrayList searchPurchaseOrderForReceipts(ReceiptSearchForm receiptSearchForm) throws ScalarException;

	/**
	 * @return
	 */
	public String loadAutomatedReceiptNo() throws ScalarException;

	/**
	 * @param receiptNumber
	 * @return
	 */
	public boolean isReceiptNumberExists(String receiptNumber) throws ScalarException;

	/**
	 * @param purchaseOrderReceiptForm
	 * @param userName
	 */
	public void savePurchaseOrderReceipt(PurchaseOrderReceiptForm purchaseOrderReceiptForm, String userName) throws ScalarException;

	/**
	 * @param purchaseOrderReceiptForm
	 */
	public void loadPurchaseOrderReceipt(PurchaseOrderReceiptForm purchaseOrderReceiptForm) throws ScalarException;

	/**
	 * @param vendor_Id
	 * @param processType
	 * @return
	 */
	public ArrayList loadPartDescription(int vendor_Id, String processType)throws ScalarException;

    /**
	 * @return
	 */
    public ArrayList loadPOTaxesList() throws ScalarException;

    /**
	 * @param state
	 * @return
	 */
    public boolean doesPOTaxStateExist (DBTransaction dbTransaction,String state) throws ScalarException;

    /**
	 * @param states
	 * @param tax
     */
    public void savePOTax(String states, String tax ) throws ScalarException;

    /**
	 * @param state
	 * @return
	 */
    public double getTaxValue(String state ) throws ScalarException;

    /**
     *
     * @param dbTransaction
     * @param poNumber
     * @param processStepId
     * @param vendorId
     * @param receiptLineItemId
     * @return
     * @throws ScalarException
     */
    public PurchaseOrderLineItemLotDataEntryList loadLotsForReceipts ( DBTransaction dbTransaction, String poNumber, int processStepId, int vendorId, int receiptLineItemId, int receiptId ) throws ScalarException;

    /**
     *
     * @param dbTransaction
     * @param poId
     * @return
     * @throws ScalarException
     */
    public int getPOMaxLineItemNo ( DBTransaction dbTransaction, int poId ) throws ScalarException;

    /**
     *
     * @param vendor_id
     * @return
     * @throws ScalarException
     */
    public ArrayList loadVendorSalesAddresses(int vendor_id) throws ScalarException;

}